
import axios from "../../requery/index";
import qs from "qs"
// 通讯设置获取请求
export function currentEuipment() {
    return axios({
        url: '/open/currentEquipment',
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}
// 通讯设置修改请求
export function commmunifunEdit(data) {
    return axios({
        url: `/biz/mesEquipment/cationSetting`,
        method: "put",
        data,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}

//获取修改后的请求
export function ObtainModifiedRequests({ id }) {
    return axios({
        url: `/biz/mesEquipment/get/${id}`,
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


//基本信息获取
// /biz/mesRegisterAddress/getByEquipmentId/{equipmentId}

export function getByEquipmentId({ equipmentId }) {
    console.log(equipmentId);
    return axios({
        url: `/biz/mesRegisterAddress/getByEquipmentId/${equipmentId}`,
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }

    })
}




// 
export function mesEquipment({ id }) {
    console.log(id);
    return axios({
        url: `/biz/mesEquipment/get/${id} `,
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }

    })
}

export function  workForCeConFig({ workforceId }) {
    return axios({
        url: `/biz/mes-workforce-config/get/${workforceId}`,
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }

    })
}
// 用户设置
//获取用户列表
export function userSettingsApi() {
    return axios({
        url: '/system/user/getUserlist',
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}
//删除用户
export function delUserList({ params }) {
    return axios({
        url: `/system/user/delete/${params.userId}`,
        method: "delete",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}
//添加用户
export function addUserList(data) {

    return axios({
        url: `/system/user/save`,
        method: "post",
        data,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}








//基本信息设置
// export function addressByCode(params) {
//     console.log(params);
export function addressByCode(data) {
    return axios({
        url: "/biz/mesRegisterAddress/updateAddressByCode",
        method: "put",
        params: params,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
        // data:JSON.stringify(data),
        // headers: { 'Content-Type': 'application/json' }
    })
}



//基本信息节拍设置

export function beatSetting(data) {
    return axios({
        url: `/biz/mesEquipment/beatSetting`,
        method: "put",
        data,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


export function delModelApi({ assemblyId }) {
    return axios({
        url: `/biz/mesAssembly/${assemblyId}`,
        method: "delete",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}







//模块表
export function GetModuleApi({ equipmentId }) {
    return axios({
        url: `/biz/mesAssembly/fetchByEquipmentId/${equipmentId}`,
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


//维护保养组件添加模块
export function addModuleApi(data) {
    return axios({
        url: `/biz/mesAssembly/addModule`,
        method: "post",
        data,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


//维护保养组件列表

export function addModuleListApi(data) {
    return axios({

        url: `/biz/mesWorkpiece/getWorkPage`,
        method: "post",
        data,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


//维护保养组件添加
export function addListApi(data) {
    return axios({
        url: `/biz/mesWorkpiece/saveWorkPiece`,
        method: "post",
        data,
        headers: { 'Content-Type': 'application/json' }
    })
}
//维护保养组件编辑
export function modiFyListApi(data) {
    return axios({
        url: `/biz/mesWorkpiece/editWork`,
        method: 'put',
        data,
        headers: { 'Content-Type': 'application/json' }

    })
}
//维护保养组件批量导入
export function downLoadFilesApi({ file, assemblyId, updateSupport }) {

    return axios({
        url: `/biz/mesWorkpiece/importData?&assemblyId=${assemblyId}&updateSupport=${updateSupport}`,
        method: 'post',
        data: file,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

//维护保养组件批量下载
export function outfile(assemblyId) {
    return axios({
        url: `/biz/mesWorkpiece/export`,
        method: "post",
        data: assemblyId,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


//维护保养组件删除
export function delTableTrApi({ workpieceId }) {
    return axios({
        url: `/biz/mesWorkpiece/deledtWorkById/${workpieceId}`,
        method: "delete",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


export function roleListFunApi() {
    return axios({
        url: `/system/role/list`,
        method: "get",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}



//班次

export function classOrderTableFunApi() {
    return axios({
        url: `/biz/mes-workforce-config/page`,
        method: "post",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}


//操作员列表
export function getUserListFunApi() {
    return axios({
        url: `/biz/mes-workforce-config/getUserList`,
        method: "post",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}



//添加
export function setUserNameFunApi(data) {
    return axios({
        url: `/biz/mes-workforce-config/add`,
        method: "post",
        data,
        headers: { 'Content-Type': 'application/json' }
    })
}
// //编辑
export function editUserNameFunApi(data) {
    return axios({
        url: `/biz/mes-workforce-config/edit`,
        method: "put",
        data,
        headers: { 'Content-Type': 'application/json' }
    })
}



export function delUserNameFunApi({ pkIds }) {
    return axios({
        url: `/biz/mes-workforce-config/${pkIds}`,
        method: "delete",
        headers: { 'Content-Type': 'application/json' }
    })
}


export function checkOutAll(data) {
    return axios({
        url: `/open/clock/checkOutAll`,
        method: "post",
        data,
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}



export function delTableFunApi({ workforceId }) {
    return axios({
        url: `/biz/mes-workforce-config/remove/${workforceId}`,
        method: "delete",
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })

}
